# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
#   include daocheng::eos9
class daocheng::eos9(
  $login_node = false,
) {
yumrepo { "eos":
      baseurl => "http://${mirrorserver}/yum/storage-ci/eos/diopside/el-${facts['os']['release']['major']}",
      descr => "eos repository",
      enabled => 1,
      gpgcheck => 0,
      priority => 1,
      before   => Yumrepo['site']
}
yumrepo { "eos-depends":
      baseurl => "http://${mirrorserver}/yum/storage-ci/eos/diopside/el-${facts['os']['release']['major']}-depends",
      descr => "eos depends repository",
      enabled => 1,
      gpgcheck => 0,
      priority => 1,
      before   => Yumrepo['site']
}
package { ["xrootd-client",
        "xrootd-devel",
        "xrootd-client-libs",
        "xrootd-libs"]:
    ensure   => "installed",
    require  => Yumrepo['site'],
}->
package { ["eos-client",
           "eos-fusex",
           "eos-fusex-selinux",
           "eos-fusex-core"]:
  ensure   => "installed",
  require  => Yumrepo['site']
} 

  if  $login_node {


  file {"/etc/eos":
    notify       =>  Service['autofs'],
    mode         =>  '0755',
    owner        =>  'root',
    group        =>  'root',
    source       =>  "puppet:///modules/${module_name}/login_etc_eos",
    recurse      =>   true,
    ensure       =>   directory,
    force        =>   true,
  }
  include autofs
  autofs::mount { 'eos':
    mount   => '/eos',
    mapfile => '/etc/auto.eos',
    options => '--timeout=120',
    use_dir => true,
  }
  autofs::mapfile { 'eos':
    path     => '/etc/auto.eos',
    mappings => [
      { 'key' => 'daocheng', 'options' => '-fstype=eosx,fsname=daocheng', 'fs' => ':eosxd' },
    ]
  }
  augeas { "autofs_conf":
    context => '/files/etc/autofs.conf',
    lens    => 'Puppet.lns',
    incl    => '/etc/autofs.conf',
    changes => [
      "set \ autofs\ /browse_mode yes",
    ],
    notify  =>  Service['autofs'],
  }
  }
}
